19 double capacity
, initial
, out
, in
;
23 for (int i
=0; i
<n
; ++i
){
25 scanf("%lf %lf", &x
, &y
);
26 p
[i
].x
= x
; p
[i
].y
= y
;
31 for (int i
=0; i
<n
; ++i
){
33 capacity
+= p
[i
].x
*p
[j
].y
- p
[j
].x
*p
[i
].y
;
35 capacity
*= (double)w
/ 2;
37 assert(capacity
> 0.0);
39 scanf("%lf %lf %lf", &initial
, &out
, &in
);
41 initial
= (capacity
* initial
) / 100.0; //Convert from percentage to volume
44 printf("Capacity es: %lf\n", capacity);
45 printf("Initial es: %lf\n", initial);
49 if (initial
< 0.0 - EPS
){
50 printf("Lack of water. ");
55 if (initial
> capacity
+ EPS
){
56 printf("Excess of water. ");
60 initial
= (initial
* 100.0) / capacity
; //Convert from volume to percentage
63 printf("Final percentage: %d\%\n", answer
);